import operate from '@dfeidao/atom-nodejs/db/operate';
import uuid from 'uuid';


// 添加角色系统参数
interface Message {
	field: string;
	fieldtitle: string;
	fieldtype: string;
	productid: string;
	role_type_id: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	const systemid = '12';
	const { insert, exec } = operate(action_id, session_id, systemid);
	insert('pub_role_sysparams', { _id: uuid(), role_type_id: msg.role_type_id, field: msg.field, fieldtitle: msg.fieldtitle, productid: msg.productid, fieldtype: msg.fieldtype });
	const res = await exec();
	if (res.code === 1) {
		return 'success';
	} else {
		return 'fail';
	}
}
